﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AdvanceLib;
using AdvanceLib.ScriptCore;

namespace ACompiler.SystemCommands
{
    public class Help : SystemCommand
    {
        #region SystemCommand Member
        public override string Name
        {
            get { return "help"; }
        }
        public override int ExpectedParameters
        {
            get { return 0; }
        }
        public override void Execute(ScriptHost host, string[] parameters)
        {
            Console.WriteLine();

            Program.WriteLine("Help:", ConsoleColor.Yellow);
            Program.WriteLine("-------------------------------------------------------------------------------", ConsoleColor.DarkYellow);

            Console.WriteLine();
            foreach (ISystemCommand command in host.ExtensionManager.SystemCommands)
            {
                if (command is IHelpEntity)
                {
                    Program.Write(command.Name + " ", ConsoleColor.White);
                    Program.WriteLine((command as IHelpEntity).GetParameterString(), ConsoleColor.Gray);

                    Program.WriteLine((command as IHelpEntity).GetDescription(), ConsoleColor.Yellow);
                    Console.WriteLine();
                }
            }
        }
        public override bool DebugParameter(int paramIndex, string paramValue)
        {
            return true;
        }
        #endregion
    }
}
